﻿using UnityEngine;
using System.Collections;
using System.IO;

/// <summary>
/// Classe chamada ao se clicar em 'Save Game'.
/// </summary>
public class Game_Save {
	
	#region Singleton
	private Game_Save(){}
	
	private static Game_Save instance;
	
	public static Game_Save getInstance()
	{
		if (instance == null)
			instance = new Game_Save();
		
		return instance;
	}
	#endregion
	
	private const string fileText = "Fase Alcançada: ";
	
	public void SaveGame ()
	{
		Game_Directory gd =  Game_Directory.getInstance();
		StreamWriter writer = new StreamWriter(gd.PathString,false);
		
		string reachedPhase = fileText + Game_Directory.getInstance().ReachedPhase;
		
		writer.Write(reachedPhase);
		writer.Close();
	}
	
	public string FileText { get { return fileText; } }
}